export default {
  namespaced: true,

  state: () => ({
    addrInfo: JSON.parse(uni.getStorageSync('addressInfo') || '{}'),
	userInfo: JSON.parse(uni.getStorageSync('userInfo') || '{}'),
	redirectInfo: JSON.parse(uni.getStorageSync('redirectInfo') || '{}'),
  }),

  mutations: {
	setAddress(state, addrObj) {
		state.addrInfo = {
			address: addrObj.provinceName + addrObj.cityName + addrObj.countyName + addrObj.detailInfo,
		    username: addrObj.userName,
			telNumber: addrObj.telNumber,
		}
		this.commit('m_user/saveAddressToStorage')
	},
	saveAddressToStorage(state) {
		uni.setStorageSync('addressInfo', JSON.stringify(state.addrInfo))
	},
	setUserInfo(state, info) {
		state.userInfo = info
		uni.setStorageSync('userInfo', JSON.stringify(state.userInfo))
	},
	updateRedirectInfo(state, redirectInfo) {
		state.redirectInfo = redirectInfo
		uni.setStorageSync('redirectInfo', JSON.stringify(state.redirectInfo))
	}
  },
  actions: {},
  getters: {
	  
  },
}